package com.liu;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 节日计算
 */
public class Festivals {

    public static void main(String[] args) throws Exception {
        SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat date1 = new SimpleDateFormat("yyyy-MM-dd");
        String nowTime = date1.format(new Date());

        String[] split = nowTime.split("-");
        Integer split1 =Integer.parseInt(split[0]);
        Integer split2 =Integer.parseInt(split[1]);
        Integer split3 =Integer.parseInt(split[2]);
        if (split2==12){
            split2=1;
        }else {
            split2=split2+1;
        }
        String wageTime ="";
        if(split2<10){
            wageTime="0"+split2.toString();
        }else {
            wageTime=split2.toString();
        }
        if (split3>15){
            wageTime = split1 + "-" + wageTime +"-"+ "15";
        }else {
            Integer split22 = Integer.parseInt(split[1]);
            if(split22<10){
                wageTime="0"+split22;
            }else {
                wageTime=split22.toString();
            }
            wageTime = split1 + "-" + wageTime +"-"+ "15";
        }

        Date offDuty = date.parse(nowTime + " 17:30:00");
        Date endDate1 = date.parse("2022-12-31 17:30:00");
        Date endDate2 = date.parse("2022-01-31 17:30:00");
        Date endDate4 = date.parse("2022-04-04 17:30:00");
        Date endDate5 = date.parse("2022-04-30 17:30:00");
        Date endDate6 = date.parse("2022-06-02 17:30:00");
        Date endDate7 = date.parse("2022-09-09 17:30:00");//中秋
        Date endDate8 = date.parse("2022-09-30 17:30:00");//国庆
        Date endDate9 = date1.parse(wageTime);

        Date nowDate = date.parse(date.format(new Date()));
        long longTime = offDuty.getTime() - nowDate.getTime();
        long longTime1 = endDate1.getTime() - nowDate.getTime();
        long longTime2 = endDate2.getTime() - nowDate.getTime();
        long longTime4 = endDate4.getTime() - nowDate.getTime();
        long longTime5 = endDate5.getTime() - nowDate.getTime();
        long longTime6 = endDate6.getTime() - nowDate.getTime();
        long longTime7 = endDate7.getTime() - nowDate.getTime();
        long longTime8 = endDate8.getTime() - nowDate.getTime();
        long longTime9 = endDate9.getTime() - nowDate.getTime();

        long day = longTime / (1000 * 60 * 60 * 24);
        long day1 = longTime1 / (1000 * 60 * 60 * 24);
        long day2 = longTime2 / (1000 * 60 * 60 * 24);
        long day4 = longTime4 / (1000 * 60 * 60 * 24);
        long day5 = longTime5 / (1000 * 60 * 60 * 24);
        long day6 = longTime6 / (1000 * 60 * 60 * 24);
        long day7 = longTime7 / (1000 * 60 * 60 * 24);
        long day8 = longTime8 / (1000 * 60 * 60 * 24);
        long day9 = longTime9 / (1000 * 60 * 60 * 24);

        long hour = longTime / (60 * 60 * 1000) - day * 24;
        long hour1 = longTime1 / (60 * 60 * 1000) - day1 * 24;
        long hour2 = longTime2 / (60 * 60 * 1000) - day2 * 24;
        long hour4 = longTime4 / (60 * 60 * 1000) - day4 * 24;
        long hour5 = longTime5 / (60 * 60 * 1000) - day5 * 24;
        long hour6 = longTime6 / (60 * 60 * 1000) - day6 * 24;
        long hour7 = longTime7 / (60 * 60 * 1000) - day7 * 24;
        long hour8 = longTime8 / (60 * 60 * 1000) - day8 * 24;
        long hour9 = longTime9 / (60 * 60 * 1000) - day9 * 24;

        long min = longTime / (60 * 1000) - day * 24 * 60 - hour * 60;
        long min1 = longTime1 / (60 * 1000) - day1 * 24 * 60 - hour1 * 60;
        long min2 = longTime2 / (60 * 1000) - day2 * 24 * 60 - hour2 * 60;
        long min4 = longTime4 / (60 * 1000) - day4 * 24 * 60 - hour4 * 60;
        long min5 = longTime5 / (60 * 1000) - day5 * 24 * 60 - hour5 * 60;
        long min6 = longTime6 / (60 * 1000) - day6 * 24 * 60 - hour6 * 60;
        long min7 = longTime7 / (60 * 1000) - day7 * 24 * 60 - hour7 * 60;
        long min8 = longTime8 / (60 * 1000) - day8 * 24 * 60 - hour8 * 60;
        long min9 = longTime9 / (60 * 1000) - day9 * 24 * 60 - hour9 * 60;

        long s = longTime / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60;
        long s1 = longTime1 / 1000 - day1 * 24 * 60 * 60 - hour1 * 60 * 60 - min1 * 60;
        long s2 = longTime2 / 1000 - day2 * 24 * 60 * 60 - hour2 * 60 * 60 - min2 * 60;
        long s4 = longTime4 / 1000 - day4 * 24 * 60 * 60 - hour4 * 60 * 60 - min4 * 60;
        long s5 = longTime5 / 1000 - day5 * 24 * 60 * 60 - hour5 * 60 * 60 - min5 * 60;
        long s6 = longTime6 / 1000 - day6 * 24 * 60 * 60 - hour6 * 60 * 60 - min6 * 60;
        long s7 = longTime7 / 1000 - day7 * 24 * 60 * 60 - hour7 * 60 * 60 - min7 * 60;
        long s8 = longTime8 / 1000 - day8 * 24 * 60 * 60 - hour8 * 60 * 60 - min8 * 60;
        long s9 = longTime9 / 1000 - day9 * 24 * 60 * 60 - hour9 * 60 * 60 - min9 * 60;

        System.out.println("下班：" + day + "天，" + hour + "小时，" + min + "分钟" + s + "秒" + " (" + (day * 24 * 60 + hour * 60 + min) + "分钟" + ")");
        System.out.println("———————————————————————————————————————————");
        System.out.println("距离下次发工资还剩：" + day9 + "天" );
        System.out.println("———————————————————————————————————————————");
        /*System.out.println("除夕：" + day2 + "天，" + hour2 + "小时，" + min2 + "分钟" + s2 + "秒" + " (" + (day2 * 24 * 60 + hour2 * 60 + min2) + "分钟" + ")");
        System.out.println("———————————————————————————————————————————");*/
        System.out.println("清明：" + day4 + "天，" + hour4 + "小时，" + min4 + "分钟" + s4 + "秒" + " (" + (day4 * 24 * 60 + hour4 * 60 + min4) + "分钟" + ")");
        System.out.println("———————————————————————————————————————————");
        System.out.println("劳动节：" + day5 + "天，" + hour5 + "小时，" + min5 + "分钟" + s5 + "秒" + " (" + (day5 * 24 * 60 + hour5 * 60 + min5) + "分钟" + ")");
        System.out.println("———————————————————————————————————————————");
        System.out.println("端午：" + day6 + "天，" + hour6 + "小时，" + min6 + "分钟" + s6 + "秒" + " (" + (day6 * 24 * 60 + hour6 * 60 + min6) + "分钟" + ")");
        System.out.println("———————————————————————————————————————————");
        System.out.println("中秋：" + day7 + "天，" + hour7 + "小时，" + min7 + "分钟" + s7 + "秒" + " (" + (day7 * 24 * 60 + hour7 * 60 + min7) + "分钟" + ")");
        System.out.println("———————————————————————————————————————————");
        System.out.println("国庆：" + day8 + "天，" + hour8 + "小时，" + min8 + "分钟" + s8 + "秒" + " (" + (day8 * 24 * 60 + hour8 * 60 + min8) + "分钟" + ")");
        System.out.println("———————————————————————————————————————————");
        System.out.println("元旦：" + day1 + "天，" + hour1 + "小时，" + min1 + "分钟" + s1 + "秒" + " (" + (day1 * 24 * 60 + hour1 * 60 + min1) + "分钟" + ")");

    }

}
